package utfpr.ct.dainf.engcomp.bean;



public class Cromossomo implements Comparable<Cromossomo>{
	
	private Gene[] genes;
	private double fitness;
	
	
	public Cromossomo(int totalGenes){
		genes = new Gene[totalGenes];
	}

	public Gene getGeneAt(int index) {
		return genes[index];
	}

	public Gene[] getGenes(){
		return genes;
	}
	
	public void setGeneAt(int index, Gene gene){
		this.genes[index] = new Gene(gene.getAlelo());
	}
	
	public int getGeneSize(){
		return genes.length;
	}

	public double getFitness() {
		return fitness;
	}

	public void setFitness(double fitness) {
		this.fitness = fitness;
	}

	@Override
	public int compareTo(Cromossomo o) {
		if( this.fitness < o.fitness )
			return -1;
		else if( this.fitness == o.fitness)
			return 0;
		else
			return 1;
	}
}
